/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef CONSTANTS_H
#define CONSTANTS_H

#include <string>

namespace OHOS {
namespace Msdp {
    // SaService constants
    constexpr int32_t MSG_MAX_SIZE = 45 * 1024;
    constexpr int32_t ENCRYPT_TAG_LEN = 32;

    // AuthConstants
    constexpr int32_t AUTH_SESSION_SIDE_SERVER = 0;
    constexpr int32_t AUTH_SESSION_SIDE_CLIENT = 1;

    constexpr int32_t DEVICE_UUID_LENGTH = 65;
    constexpr int32_t INVALID_SESSION_ID = -1;

    // Rdb
    constexpr int INVALID_DATA = -1;
    constexpr int DIRECTION_MIN_VALUE = -1;
    constexpr int DIRECTION_MAX_VALUE = 6;
    constexpr int DIRECTION_SCOPE_MIN = 1;
    constexpr double DISTANCE_MIN_VALUE = 0;
    constexpr double DISTANCE_MAX_VALUE = 200;
    constexpr double DISTANCE_SCOPE_MIN = 0;
    constexpr double ANGLE_MIN_VALUE = 0;
    constexpr double ANGLE_MAX_VALUE = 360;
    constexpr double ANGLE_SCOPE_MIN = 0;
    constexpr double ANGLE_SCOPE_MAX = 360;
    constexpr int IO_MIN_VALUE = -2;
    constexpr int IO_MAX_VALUE = 1;
    constexpr int IO_SCOPE_MIN = 0;
    constexpr int EXIST_MIN_VALUE = -2;
    constexpr int EXIST_MAX_VALUE = 1;
    constexpr int EXIST_SCOPE_MIN = 0;
    constexpr int PERIGON = 360;
    const std::string DATABASE_NAME = "/data/SpatialAwareness.db";
    const std::string DIRECTION_TABLE = std::string("CREATE TABLE IF NOT EXISTS direction") +
        std::string("(ID INTEGER PRIMARY KEY AUTOINCREMENT, DIRECTION INTEGER)");
    const std::string DISTANCE_TABLE = std::string("CREATE TABLE IF NOT EXISTS distance") +
        std::string("(ID INTEGER PRIMARY KEY AUTOINCREMENT, DISTANCE REAL)");
    const std::string ANGLE_TABLE = std::string("CREATE TABLE IF NOT EXISTS angle") +
        std::string("(ID INTEGER PRIMARY KEY AUTOINCREMENT, ANGLE REAL)");
    const std::string INNEROUTER_TABLE = std::string("CREATE TABLE IF NOT EXISTS innerouter") +
        std::string("(ID INTEGER PRIMARY KEY AUTOINCREMENT, INNEROUTER INTEGER)");
    const std::string EXIST_TABLE = std::string("CREATE TABLE IF NOT EXISTS exist") +
        std::string("(ID INTEGER PRIMARY KEY AUTOINCREMENT, EXIST INTEGER)");
    const std::string SQL_CREATE_TABLE_SPATIAL_RELATION = std::string("CREATE TABLE IF NOT EXISTS SPATIAL_RELATION") +
        std::string("(ID INTEGER PRIMARY KEY AUTOINCREMENT, "
        "DIRECTION INTEGER, DISTANCE DOUBLE, ANGLE INTEGER, "
        "INNER_OUTER INTEGER, EXIST INTEGER)");
    // mode flag
    constexpr int32_t INVALID_MODE = 0;
    constexpr int32_t DIRECTION_MODE = 0x1;
    constexpr int32_t DISTANCE_MODE = 0x2;
    constexpr int32_t ANGLE_MODE = 0x4;
    constexpr int32_t INNEROUTER_MODE = 0x8;
    constexpr int32_t EXIST_MODE = 0x10;
    constexpr int32_t TIMER_INTERVAL = 10000;

    // msdp algorithm name
    const std::string DIRECTION_ALGORITHM_LIB_PATH = "libmsdp_direction_algorithm.z.so";
    const std::string DISTANCE_ALGORITHM_LIB_PATH = "libmsdp_distance_algorithm.z.so";
    const std::string ANGLE_ALGORITHM_LIB_PATH = "libmsdp_angle_algorithm.z.so";
    const std::string INNEROUTER_ALGORITHM_LIB_PATH = "libmsdp_innerouter_algorithm.z.so";
    const std::string EXIST_ALGORITHM_LIB_PATH = "libmsdp_exist_algorithm.z.so";
    const std::string ALGORITHM_COMMON_PATH = "/system/lib/";
} // namespace Msdp
} // namespace OHOS
#endif // CONSTANTS_H